<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>{dreamer-cms:global name="title" /}-{dreamer-cms:category field="typenamecn" /}</title>
  <link rel="icon" href="{dreamer-cms:template /}images/favicon.ico" />
  <meta name="Keywords" content="{dreamer-cms:global name='keywords' /}" />
  <meta name="Description" content="{dreamer-cms:global name='describe' /}" />
  <link href="{dreamer-cms:template /}css/output.css" rel="stylesheet" />
  <link rel="stylesheet" href="{dreamer-cms:template /}css/variables.css" />
  <style>
    .cat-nav::before {
      content: "";
      width: 8px;
      height: 72px;
      background-color: #FFFAED;
      border-radius: 0.5rem;
    }

    .cat-nav.active {
      background-color: #FFE9B5;
      font-weight: bold;
    }

    .cat-nav.active::before {
      background-color: #FFB300;
    }
  </style>
</head>

<body class="bg-white">
  <!-- 导航栏 -->
  <div class="sticky top-0 z-50">
    {dreamer-cms:include file='inc/header.html'/}
  </div>
  <p id="listCatUrl" class="hidden">{dreamer-cms:category field="visiturl" /}</p>
  <main class="container mx-auto px-4 pb-4 lg:pb-10 mt-4 lg:mt-10">
    <div class="container mx-auto px-4 py-6 md:py-8 max-w-6xl">
      <img src='{dreamer-cms:topcategory field="typeimg" /}' class="w-full mb-4 md:mb-12" alt="">
      <!-- 主要内容区 -->
      <div class="flex flex-col md:flex-row gap-4">
        <!-- 左侧分类导航 -->
        <div class="hidden lg:block w-full md:w-1/4">
          <div class="bg-light  shadow-sm overflow-hidden">
            <ul>
              {dreamer-cms:channel typeid="t6la3r6f" showall="false" type="son"}
              <li class=" cat-nav flex items-center bg-[#FFFAED] mb-[6px] h-[72px] rounded-lg ">
                <a href="[field:typeurl /]" target="[field:target /]" title="[field:title /]"
                  class="category-item block px-4 py-3 lg:text-2xl w-full h-full flex items-center text-[#262626]  transition">
                  [field:typenamecn /]
                </a>
              </li>
              {/dreamer-cms:channel}
            </ul>
          </div>
        </div>
        
        
        <!-- 右侧资源列表 -->
        <div class="w-full md:w-3/4 bg-[#ffffff]">
          <img src='{dreamer-cms:category field="typeimg" /}' class="w-full mb-4 md:mb-12" alt="">
          <div class="bg-light rounded-lg shadow-sm  ">
            <div class="">
              {dreamer-cms:pagelist}
              <div
                class="flex justify-between items-center  py-4 px-4 md:px-6 border-b cursor-pointer hover:bg-[#F1F1F1] transition  border-gray-200">
                <a href="[field:arcurl/]" class="text-gray-800 w-full h-full flex items-center justify-between">
                  <span>[field:title /]</span>
                  <span class="text-gray-400">[field:createtime function="format('yyyy-MM-dd HH:mm:ss')" /]</span>
                </a>
              </div>
              {/dreamer-cms:pagelist}
            </div>
          </div>
          {dreamer-cms:pagination /}
        </div>
      </div>
    </div>
  </main>
  <!-- 页脚 -->
  {dreamer-cms:include file="inc/footer.html" /}

  <!-- JavaScript -->
  <script>
    // categoryList[0].classList.add('active');
    const listCatUrlElement = document.getElementById('listCatUrl');
    if (listCatUrlElement) {
      const listCatUrl = listCatUrlElement.textContent.trim();
      const categoryItems = document.querySelectorAll('.category-item');

      categoryItems.forEach(link => {
        if (link.href.includes(listCatUrl.trim())) {
          // 当 visitUrl 不为 '/' 时，正常匹配
          link.parentElement.classList.add('active');
        }
      });
    }
  </script>
</body>

</html>